Skip to content

fix(ai): keep latest session request owner - #2829

Open
HandSonic wants to merge 2 commits into
OtterMind:mainfrom
HandSonic:fix/ai-session-latest-owner
Open

HandSonic wants to merge 2 commits into
OtterMind:mainfrom
HandSonic:fix/ai-session-latest-owner

Conversation

@HandSonic

@HandSonic HandSonic commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

Related issue

N/A - no matching issue was found.

Summary

Historical AI session loads had no latest-request ownership, so an older response or finally could overwrite a newer session and clear its loading state. An externally-triggered new chat also scheduled a send through a stale render closure, carrying the previous session/history. This change introduces a session generation coordinator, invalidates loads on new chat, and resolves external sends from their explicit new-session owner.

Affected surfaces

  • Frontend / Web
  • Backend / API / Storage
  • Database plugin / Driver
  • JCEF / Desktop packaging
  • CI / Build / Release
  • Documentation only

Verification

  • Commands and results:
    • Session coordinator tests: passed for A/B reverse completion, stale finally, new-chat invalidation, and external send context.
    • Retired-AI contracts: passed.
    • Targeted ESLint: passed.
    • Full Community prebuild, Umi/Webpack build, and production bundle verifier: passed.
    • Fork code and CodeQL checks: passed.
    • Playwright: A/B reverse completion, stale finally loading ownership, and new-chat invalidation all passed with delayed mocked history responses.
    • Pairwise merge-tree with fix(ai): keep latest mention table request #2833: passed.
  • Manual verification: Passed in the Community workspace AI panel with delayed A/B history responses.
  • UI evidence: N/A

Risk and compatibility

  • Public API or stored data: No public API or persisted history format changes.
  • Database or driver compatibility: N/A.
  • Network, privacy, or security: Prevents messages from being sent with an unintended prior session context.
  • Community / Local / Pro boundary: Shared Community AI session UI.
  • Backward compatibility: Current-session loads and ordinary sends retain existing request payloads.

Reviewer map

  • Start here: sessionRequestCoordinator.ts, then AI.handleLoadSessionById, handleNewChat, and handleSend.
  • Failure condition: stale loads commit messages/errors/loading, or an external new chat sends the old session/history.
  • Rollback or disable path: Revert commit 862b39fb1b9f83d25ab84656edb27def42cff426; no migration is required.

Contributor declaration

  • I linked the Issue that defines this change.
  • I tested the affected behavior and reported the actual results above.
  • I did not include credentials, private data, or generated build output.
  • I disclosed substantial AI assistance below, or this PR contains no substantial AI-generated code.

AI assistance: OpenAI Codex assisted with diagnosis, implementation, automated tests, verification, and adversarial review.

@HandSonic
HandSonic force-pushed the fix/ai-session-latest-owner branch from 2ce2132 to 862b39f Compare September 3, 2026 15:58
Align existing OtterMind/Chat2DB PR OtterMind#2829, retaining its focused behavior and current Community contracts.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

2 participants